package jfox.platform.organization.bo;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Local;
import javax.ejb.Stateless;

import jfox.platform.infrastructure.DataAccessObject;
import jfox.platform.infrastructure.SuperBO;
import jfox.platform.organization.entity.Company;
import jfox.platform.organization.dao.CompanyDAO;

/**
 * @author <a href="mailto:ren.yingb@gmail.com">Ren Yingbo</a>
 */
@Stateless
@Local
public class CompanyBOBean extends SuperBO implements CompanyBO{

	@EJB
	CompanyDAO companyDAO;
	
	public DataAccessObject getDataAccessObject() {
		return companyDAO;
	}

	public void newCompany(Company company) {
		companyDAO.insertCompany(company);
	}
	 /**
     * sheshengdian 新增 根据部门增加单位
     * @param company
     */
	public void newCompanyByDepartment(Company company) {
		companyDAO.insertCompanyByDeparment(company);
	}
	public void deleteCompany(long id) {
		companyDAO.deleteCompany(id);
	}
	
	public void updateCompany(Company company) {
		companyDAO.updateCompany(company);
	}
	
	public void updateCompanyByDepartment(Company company) {
		companyDAO.updateCompanyByDepartment(company);
	}
	
	public List<Company> getAllCompanys() {
		return companyDAO.getAllCompanys();
	}

	public Company getCompanyById(long id) {
		return companyDAO.getCompanyById(id);
	}

	
}
